echo off
rem 1 - host
rem 2 - db name
rem  3 - user
rem 4 - password (optional)
if "%4" == "" set PGPASSWORD=%3
if not "%4" == "" set PGPASSWORD=%4
if "%2" == "" set expr_db=%1
if not "%2" == "" set expr_db=%2
echo on
call chcp 1251
call title psql %1 %expr_db%
call psql -h %1 -U %3 %expr_db%
exit